<div class="nav">
    <a href="{:U('index')}">模型列表</a>
    <a href="{:U('attr_index',array('model_id'=>$model_id))}">属性管理</a>
    <a class="sel" >修改属性</a>
</div>
<div class="add">
  <form method="post" name="edit" id="edit" action="" >
  <table class="table_add">
    <tr>
      <td width="100px">属性名称</td>
      <td><input class="input1" type="text" name="attr_name" id="attr_name" value="{$model.attr_name}" style="width:140px" /> </td>
    </tr>
    <tr>
      <td width="100px">输入方式</td>
      <td>
          <select name="attr_type" id="attr_type" class="sel1">
              <option value="1">输入框</option>
              <option value="2">选择框</option>
              <option value="3">单选框</option>
              <option value="4">多选框</option>
          </select>
      </td>
    </tr>
     <tr class="tr_sel" style="display:none;">
      <td width="100px">前台搜索</td>
      <td>
          <select name="is_search" id="is_search" class="sel1">
              <option value="1">不搜索</option>
              <option value="2">单选搜索</option>
              <option value="3">多选搜索</option>
          </select>
      </td>
    </tr>
    <tr>
      <td width="100px">顺序编号</td>
      <td><input class="input1" type="text" name="order_id" id="order_id" value="{$model.order_id}" style="width:60px" /> <span class="msg">*</span></td>
    </tr>
    <tr>
      <td width="100px">是否启用</td>
      <td><select name="is_enable" id="is_enable" class="sel1">
             <option value="1">启用</option>
             <option value="0">不启用</option>
          </select>
      </td>
    </tr>
    <tr>
      <td></td>
      <td><input type="submit" class="btn1" value="提 交" /> &nbsp;<input class="btn3"  type="button" onclick="document.location='{:U('attr_index',array('model_id'=>$model_id))}'" value="返 回" /></td>
    </tr>
  </table>
    <input type="hidden" name="attr_id" id="attr_id" value="{$model.attr_id}" />
    <script type="text/javascript">
        $("#attr_type").val("{$model.attr_type}");
        $("#is_search").val("{$model.is_search}");
        $("#is_enable").val("{$model.is_enable}");
        var attr_type = $("#attr_type").val();
        if(attr_type == '2' || attr_type == '3' || attr_type == '4') {
            $(".tr_sel").show();
        } else {
            $(".tr_sel").hide();
        }
        $(function(){
            $("#attr_type").change(function(){
                 var attr_type = $("#attr_type").val();
                 if(attr_type == '2' || attr_type == '3' || attr_type == '4') {
                      $(".tr_sel").show();
                 } else {
                      $(".tr_sel").hide();
                 }
            })
        });   
    </script>
  </form>
</div>
<div class="list">
    <table class="table_list">
        <thead><tr>
                <td>属性选项值</td>
                <td width="80px">顺序编号</td>
                <td width="80px">是否启用</td>
                <td width="80px">操作</td>
            </tr>
        </thead>
        <tbody>
        <foreach name="sel_list" item="list">
            <tr>
                <td class="edit_input" attr_t="attr_sel_name" attr_id="{$list.attr_sel_id}">{$list.attr_sel_name}</td>
                <td class="edit_input" attr_t="order_id" attr_id="{$list.attr_sel_id}">{$list.order_id}</td>
                <td class="edit_toggle" attr_t="is_enable" attr_id="{$list.attr_sel_id}">{$list.is_enable}</td>
                <td><a class="btn_a2" href="{:U('attr_sel_del',Array('attr_sel_id'=>$list['attr_sel_id']))}" onclick="return confirm('确定删除吗？这将删除所有关联的商品值')">删除</a></td>
            </tr>
        </foreach>
            <form method="post" name="add" id="add" action="{:U('attr_sel_add',array('model_id'=>$model_id,'attr_id'=>$attr_id))}" >
            <tr>
                <td><input type="text" name="attr_sel_name" id="attr_sel_name" value="" /></td>
                <td><input type="text" name="order_id" id="order_id" value="999" /></td>
                <td><select name="is_enable" id="is_enable" class="sel1">
                        <option value="1">启用</option>
                        <option value="0">不启用</option>
                    </select></td>
                <td><input type="submit" class="btn1" value="添 加" /> </td>
            </tr>
            </form>
        </tbody>
    </table>
</div>